package scheduler

import "learngo/crawler/engine"

type SimpleScheduler struct {
	workerChannel chan engine.Request
}

func (s *SimpleScheduler) WorkerReady(chan engine.Request) {}

func (s *SimpleScheduler) WorkerChan() chan engine.Request {
	return s.workerChannel
}

func (s *SimpleScheduler) Run() {
	s.workerChannel = make(chan engine.Request)
}

func (s *SimpleScheduler) Submit(r engine.Request){
	//放入gorutine当中，否则会导致协程耗尽而卡死
	go func() {s.workerChannel <- r}()
}

